<script setup lang="ts">
import { computed } from "vue";
import { ref } from "vue";
import ReCol from "@/components/ReCol";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    gain_limt: null,
    lock_limit: null,
    silent_day: null,
    valid_day: null,
    sea_limit: null
  })
});

const ruleFormRef = ref();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="newFormInline"
    :rules="formRules"
    label-width="188px"
  >
    <el-row :gutter="30">
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="客户领取数阀值:" prop="gain_limt">
          <el-input
            v-model="newFormInline.gain_limt"
            clearable
            maxlength="20"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="客户锁定数阀值:" prop="lock_limit">
          <el-input
            v-model="newFormInline.lock_limit"
            clearable
            maxlength="20"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="公海客户静默期（天）:" prop="silent_day">
          <el-input
            v-model="newFormInline.silent_day"
            clearable
            maxlength="20"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="释放到公海因未跟进天数:" prop="valid_day">
          <el-input
            v-model="newFormInline.valid_day"
            clearable
            maxlength="20"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="进入公海次数上限:" prop="sea_limit">
          <el-input
            v-model="newFormInline.sea_limit"
            clearable
            maxlength="20"
            placeholder="请输入"
            show-word-limit
          />
        </el-form-item>
      </re-col>
    </el-row>
  </el-form>
</template>
